The production of water with hydrocarbons, e.g., oil and/or gas, from wells constitutes a major problem and expense in the production of hydrocarbons from subterranean formations. In addition to problems related to dealing with produced water such as separation, transportation and disposal, the associated problems which arise as a result of water flow into the wellbore include increased sand production, fines production, damage to formation permeability due to fines migration. Chemical compositions have been utilized to decrease the amount of produced water. When water and oil producing are not inadequately isolated from each other, chemical compositions sometimes contain polymeric materials referred to as relative permeability modifiers (“RPMs”), sometimes referred to as disproportionate permeability reducers or selective plugging systems are injected into the formation. An RPM polymer, such as polyacrylamide or water soluble polyacrylate with suitable pendant branches, is dissolved in water and pumped into a subterranean formation that produces water and hydrocarbon. The polymer reduces the permeability of water through the formation without substantially affecting the permeability of hydrocarbon. However, such polymer treatments may not prevent or reduce fines migration or sand production. Additionally, in enhanced oil recovery operations (EOR), frequently water is injected into the injection well to sweep oil towards a produced well. When high permeability channels or zones exist that connect an injection well with the producer well, much of the water typically injected at high rates finds its way to produced wells by bypassing the oil producing zones. Such high permeability channels also enhance fines migration causing near wellbore permeability in the vicinity of the producer well. Thus, there is a need for treatments which can minimize fines migration and production and at the same allow for water permeability modification.